<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>初始化数据</title>
		<link rel="stylesheet" href="${request.contextPath}/static/asset/jquery-ui/1.11.1/jquery-ui.min.css">
		<link rel="stylesheet" href="${request.contextPath}/static/asset/jqGrid/4.6.0/css/ui.jqgrid.css">
		<#include "../../inc/css.ftl">
   		<link rel="stylesheet" href="${request.contextPath}/static/asset/webuploader/webuploader.css">
	</head>
	<body class="no-skin">
		<div class="container-fluid">
			<div class="row">
			  <div class="breadcrumbs">
				<ul class="breadcrumb">
					<li><i class="ace-icon fa fa-home home-icon"></i><a href="${request.contextPath}/index.jspx" target="_top">首页</a></li>
					<li><a href="">仓库</a></li>
					<li><a href="index.jspx">基础数据导入</a></li>
					<li class="active">列表</li>
				</ul>
				  <!-- /.breadcrumb -->
			  </div>
			  <!-- /.breadcrumbs -->
			</div>
			<!-- /.row -->
			<div class="row">
				<div class=""page-content>
				<form action="" method="post" class="form-horizontal" role="form" id="form-data" onsubmit="return false;">
						    	
						    	<div class="form-group">
									<label class="col-sm-2 control-label no-padding-right"> 数据类别 </label>
									<div class="col-sm-4">
										<select id="data_type" name="dateType">
									    	<option value="0" selected>库存导入</option>
									    	<option value="1">物料基本信息</option>
									    	<option value="2">BOM基本信息</option>
									    </select>
									    <a id="stock_file" href="/u/report/template/excel/stock.xls" title="库存模板" target="_blank">库存模板</a>
									    <a id="material_file" style="display:none" href="/u/report/template/excel/material.xls" title="物料模板" target="_blank">物料模板</a>
									    <a id="bom_file" style="display:none" href="/u/report/template/excel/bom.xls" title="BOM模板" target="_blank">BOM模板</a>
									</div>
									<div class="col-sm-4">
										<label><input type="radio" id="import_type_0" name="import_type" value="0" > 增量导入</label>
										<label><input type="radio" id="import_type_0" name="import_type" value="1" checked > 增量覆盖导入</label>
										<label><input type="checkbox" id="has_header" name="has_header" value="1" checked> 包含标题行</label>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label no-padding-right"> 数据文件 </label>
									<div class="col-sm-6">
										<input id="linkurl" name="linkurl" type="text" placeholder="excel地址" class="form-control">
                                        </div>
                                        <div id="upload2">
                                        </div>
									</div>
								</div>

								<div class="clearfix form-actions">
									<div class="col-sm-offset-2 col-sm-4">
										<button type="button" class="btn btn-info" id="start_button">
											<i class="ace-icon fa fa-undo bigger-110"></i>
											开始解析
										</button>
										&nbsp;&nbsp;
										<button type="button" class="btn btn-info" id="import_button">
											<i class="ace-icon fa fa-check bigger-110"></i>
											导入数据
										</button>
										<input type="hidden" id="import_flag" value="0">
									</div>
								</div>
								<div class="col-sm-offset-1">
									<div id="import_info"></div>
								</div>
						    </form>  
			   </div>
			   <input type="hidden" id="row_count" value="0">
			   <div id="stock_init" style="display:none">
			   <table class="table">
			   	<thead>
			   		<tr>
			   			<td>序号</td>
			   			<td>年</td>
			   			<td>月</td>
			   			<td>日</td>
			   			<td>物料编号</td>
			   			<td>物料名称</td>
			   			<td>物料规格</td>
			   			<td>库存</td>
			   			<td>单位</td>
			   		</tr>
			   		</thead>
			   		<tbody id="stock_init_body">
			   		
			   		</tbody>
			   </table>
			   <script type="text/html" id="stock_init_template">
			   		{{each materialStocks as materialStock index}}
			   		<tr>
			   			<td>{{index+1}}</td>
			   			<td>{{materialStock.year}}</td>
			   			<td>{{materialStock.month}}</td>
			   			<td>{{materialStock.day}}</td>
			   			<td>{{materialStock.materialCode}}</td>
			   			<td>{{materialStock.materialName}}</td>
			   			<td>{{materialStock.model}}</td>
			   			<td>{{materialStock.stock}}</td>
			   			<td>{{materialStock.unit}}</td>
			   		</tr>
			   		{{/each}}
			   </script>
			   </div>
			   <!-- /#stock_init -->
			   <div id="material_init" style="display:none">
			   		<table class="table">
			   	    <thead>
			   		<tr>
			   			<td>序号</td>
			   			<td>类别</td>
			   			<td>物料代号</td>
			   			<td>物料名称</td>
			   			<td>芯数</td>
			   			<td>型号</td>
			   			<td>规格</td>
			   			<td>颜色</td>
			   			<td>单位</td>
			   		</tr>
			   		</thead>
			   		<tbody id="material_init_body">
			   		
			   		</tbody>
			   </table>
			   <script type="text/html" id="material_init_template">
			   		{{each materials as material index}}
			   		<tr>
			   			<td>{{index+1}}</td>
			   			<td>{{#material.categoryName}}</td>
			   			<td>{{material.code}}</td>
			   			<td>{{material.name}}</td>
			   			<td>{{material.wire}}</td>
			   			<td>{{material.model}}</td>
			   			<td>{{material.specification}}</td>
			   			<td>{{material.color}}</td>
			   			<td>{{material.unit}}</td>
			   		</tr>
			   		{{/each}}
			   </script>
			   </div>
              <!-- /#material_init -->
			   <div id="bom_init" style="display:none">
			   <form id="bom_form" onsubmit="return false" method="post">
			   <table class="table">
			   	<thead>
			   		<tr>
			   			<td>序号</td>
			   			<td>工序</td>
			   			<td>物料代号</td>
			   			<td>物料名称</td>
			   			<td>规格型号</td>
			   			<td>描述</td>
			   			<td>数量</td>
			   			<td>关键特性</td>
			   			<td>导体结构</td>
			   			<td>绝缘厚度</td>
			   			<td>外径</td>
			   			<td>存储类型</td>
			   			<td>单位</td>
			   			<td>计划长度</td>
			   			<td>父件料号</td>
			   			<td>父件规格</td>
			   		</tr>
			   		</thead>
			   		<tbody id="bom_init_body">
			   		
			   		</tbody>
			   </table>
			   </form>
			   <script type="text/html" id="bom_init_template">
			   		{{each materialBoms as materialBom index}}
			   		<tr>
			   			<td>{{index+1}}</td>
			   			<td><input type="hidden" name="process_{{index}}" value="{{materialBom.process}}">{{materialBom.process}}</td>
			   			<td><input type="hidden" name="materialCode_{{index}}" value="{{#materialBom.materialCode}}">{{#materialBom.materialCode}}</td>
			   			<td><input type="hidden" name="materialName_{{index}}" value="{{materialBom.materialName}}">{{materialBom.materialName}}</td>
			   			<td><input type="hidden" name="materialModel_{{index}}" value="{{materialBom.materialModel}}">{{materialBom.materialModel}}</td>
			   			<td><input type="hidden" name="materialDesc_{{index}}" value="{{materialBom.materialDesc}}">{{materialBom.materialDesc}}</td>
			   			<td><input type="hidden" name="needNum_{{index}}" value="{{materialBom.needNum}}">{{materialBom.needNum}}</td>
			   			<td><input type="hidden" name="special_{{index}}" value="{{materialBom.special}}">{{materialBom.special}}</td>
			   			<td><input type="hidden" name="structure_{{index}}" value="{{materialBom.structure}}">{{materialBom.structure}}</td>
			   			<td><input type="hidden" name="thickness_{{index}}" value="{{materialBom.thickness}}">{{materialBom.thickness}}</td>
			   			<td><input type="hidden" name="outerDiameter_{{index}}" value="{{materialBom.outerDiameter}}">{{materialBom.outerDiameter}}</td>
			   			<td><input type="hidden" name="storeType_{{index}}" value="{{materialBom.storeType}}">{{materialBom.storeType}}</td>
			   			<td><input type="hidden" name="unit_{{index}}" value="{{materialBom.unit}}">{{materialBom.unit}}</td>
			   			<td><input type="hidden" name="planNum_{{index}}" value="{{materialBom.planNum}}">{{materialBom.planNum}}</td>
			   			<td><input type="hidden" name="code_{{index}}" value="{{materialBom.code}}">{{materialBom.code}}</td>
			   			<td><input type="hidden" name="model_{{index}}" value="{{materialBom.model}}">{{materialBom.model}}</td>
			   		</tr>
			   		{{/each}}
			   </script>
			   </div>
			   <!-- /#bom_init -->
			</div>
		</div>
		<#include "../../inc/js.ftl">
		<script src="${request.contextPath}/static/asset/zTree/3.5.17/js/jquery.ztree.core-3.5.js"></script>
		<script src="${request.contextPath}/static/asset/jquery-ui/1.11.1/jquery-ui.min.js"></script>
		<script src="${request.contextPath}/static/asset/jqGrid/4.6.0/js/i18n/grid.locale-cn.js"></script>
		<script src="${request.contextPath}/static/asset/jqGrid/4.6.0/js/jquery.jqGrid.min.js"></script>
		<script src="${request.contextPath}/static/skin/default/js/custom-jqgrid.js"></script>
		<script src="${request.contextPath}/static/asset/webuploader/webuploader.js"></script>
        <script src="${request.contextPath}/static/skin/default/js/uploader.js"></script>
		<script src="${request.contextPath}/static/asset/jquery/template.js"></script>
        <script src="${request.contextPath}/static/asset/jquery/jquery.form.js"></script>
		<script src="${request.contextPath}/static/skin/default/js/repo-list.js"></script>
		<script>
			$(document).ready(function(){
				CustomUploader.uploadFiles.init("linkurl","upload2");
				repo.InitData.start('${request.contextPath}');
				repo.InitData.import('${request.contextPath}');
			});
		</script>	
	</body>
</html>